Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
What is replacing .then(data => console.log(data)) with just .then(console.log) called?

I saw the following code in a React application.

getData()
        .then(res => res.json())
        .then(console.log)

And it behaves exactly the same as I would use

getAllStudents()
        .then(res => res.json())
        .then(data => console.log(data))

So in the first example the called function console.log somehow implicitly knows it should take the data as parameter and show it in the console. That function is not even called with console.log()

Could you please tell me what this shortcut concept is called? I would like to read more about it, but I don't know how exactly I should use it.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It is called "point free style" or tacit programming.

See e.g. https://en.wikipedia.org/wiki/Tacit_programming

Edit: The above case may not exactly be tacit programming, as that involves defining functions without explicitly mentioning their arguments ("tacit" = "implicit"), and here you are merely using an already defined function as an argument. But a function definition

const log = console.log

would be a tacit function, as opposed to

const log = data => console.log(data)

so the concept is at least closely related to the difference in the question.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!